Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to forward laz header info #149

Merged
merged 3 commits into from
Jan 23, 2024
Merged

Conversation

uclaros
Copy link
Contributor

@uclaros uclaros commented Jan 5, 2024

This PR adds a --forward_all option. When this option is used in single file mode, and a single input las/laz file is used then the following header info are preserved:

  • file source id
  • global encoding (except the wkt bit)
  • creation day
  • creation year
  • system identifier
  • generating software
  • offsets (scale was already preserved)

This will ultimately be used in QGIS by default so that Untwine is a transparent stage for the end user.

Also, when the --forward_all option is not used, the creation day/year is now correctly populated and the generating software is populated with Untwine

Fixes #139

@hobu
Copy link
Collaborator

hobu commented Jan 5, 2024

the creation day/year is now correctly populated

I've always wondered if we should be doing that when we write LAS files. The spec is ambiguous about it ASPRSorg/LAS#138

@abellgithub
Copy link
Collaborator

Do we need this to be an option? What's the downside of always doing this?

@hobu
Copy link
Collaborator

hobu commented Jan 5, 2024

Do we need this to be an option? What's the downside of always doing this?

None as far as I'm concerned. Maybe it is best to always forward in the single input case.

Note that I'll be adding support for setting additional VLRs and explicitly setting more LAS header fields in the coming months.

@uclaros
Copy link
Contributor Author

uclaros commented Jan 5, 2024

Should I interpret the above as:

  1. drop the --forward_all option and always forward for single in/out
  2. leave day/year as 1/1 when not forwarding or not available in input file

?

@hobu
Copy link
Collaborator

hobu commented Jan 5, 2024

drop the --forward_all option and always forward for single in/out

Fine with me, but it is up to you.

leave day/year as 1/1 when not forwarding or not available in input file

I say leave it as you currently have implemented – if nothing to forward, use now() to fill day/year in.

@@ -63,10 +67,18 @@ struct BaseInfo
DimInfoList dimInfo;
pdal::SpatialReference srs;
int pointFormatId;
uint16_t globalEncoding {0};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given what we're doing here, would it make sense just to include an entire lazperf::header, rather than all these separate fields? I think that would make it more clear what this data is all about, rather than just have it be random stuff sitting in the BaseInfo block. We can merge this and I can take care of that change if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that too when I kept adding members there, but wasn't too sure, as there will be unused lazperf::header(14?) variables there that might be confusing.

@@ -42,11 +42,15 @@ CopcSupport::CopcSupport(const BaseInfo& b) : m_b(b),
m_f.open(toNative(b.opts.outputName), std::ios::out | std::ios::binary);

//ABELL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These "//ABELL" comments should be removed. There were just there to note that the values were crap, but you've fixed that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -47,6 +48,7 @@ struct Options
bool stats;
std::string a_srs;
bool metadata;
bool forwardAll;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd vote for removing the option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Fix stringop-truncation warning
@hobu hobu merged commit 2bd4685 into hobuinc:main Jan 23, 2024
3 checks passed
@uclaros uclaros deleted the forward_all branch January 27, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customizable metadata when writing COPC files
3 participants